#include "SQLDropResourceStatement.h"

#include "../SQLName.h"
#include "../../../DbType.h"
#include "../../visitor/SQLASTVisitor.h"

SQLDropResourceStatement::SQLDropResourceStatement()
{
}

SQLDropResourceStatement::SQLDropResourceStatement(DbType_ptr  dbType)
    : SQLStatementImpl(dbType)
{
}

void SQLDropResourceStatement::accept0(SQLASTVisitor_ptr visitor)
{
  if (visitor->visit(SharedObject(SQLDropResourceStatement)))
  {
    acceptChild(visitor, name);
  }
  visitor->endVisit(SharedObject(SQLDropResourceStatement));
}

SQLName_ptr SQLDropResourceStatement::getName()
{
  return name;
}

void SQLDropResourceStatement::setName(SQLName_ptr x)
{
  if (x != NULL)
  {
    x->setParent(SharedObject(SQLDropResourceStatement));
  }
  this->name = x;
}

BOOL_ptr SQLDropResourceStatement::isIfExists()
{
  return ifExists;
}

void SQLDropResourceStatement::setIfExists(BOOL_ptr ifExists)
{
  this->ifExists = ifExists;
}

SQLObject_list_ptr  SQLDropResourceStatement::getChildren()
{
  SQLObject_list_ptr  children = std::make_shared<std::list<SQLObject_ptr>>();
  if (name != NULL)
  {
    children->push_back(std::dynamic_pointer_cast<SQLObject>(name));
  }
  return children;
}
